
<?php 
App::Import('Model', 'Movimiento');
$mov = new Movimiento();
?>

<?php echo $this->Html->script(array('print')); ?>
<section role="main" id="main">

    <noscript class="message black-gradient simpler">Your browser does not support JavaScript! Some features won't work as expected...</noscript>
 <div id="areaImprimir">
    <hgroup id="main-title" class="thin">
    <?php echo $this->Html->image('viva.jpg');?>
        <h1 align="center">NOTA DE ENTREGA</h1>
    </hgroup>
    <table class="simple-table responsive-table" id="sorting-example2">


            <thead>
                
                <tr>
                    <td>
                    FECHA: <?php echo date('d-m-Y')?>
                    </td>
                    <td>
                    DISTRIBUIDOR: <?php echo $persona['Persona']['nombre'].' '.$persona['Persona']['ap_paterno'].' '.$persona['Persona']['ap_materno'];?>
                    </td>
                </tr>
                
            </thead> 
        </table>
        <table class="simple-table responsive-table" id="sorting-example2">

            <thead>
                <tr>  
                    <th>Tipo</th>
                <?php foreach($productos as $pro):?>
                    <th><?php echo $pro['Producto']['nombre']?></th>
                    
                    <?php endforeach;?>
                </tr>
            </thead>          

            <tbody>
                    <tr>                      
                        <td>Ingresos</td>
                        <?php foreach($productos as $pro):?>
                        <?php
                        $idProducto = $pro['Producto']['id'];
                        $dato = $mov->find('first', array(
                                    'conditions'=>array(
                                                       'Movimiento.producto_id'=>$idProducto,
                                                       'Movimiento.persona_id'=>$idPersona
                                                       ),
                                    'order'=>array('Movimiento.id DESC'),
                                    'recursive'=>-1
                            ));
                           //debug($dato);
                            if(!empty($dato)){
                                $ingreso = $dato['Movimiento']['ingreso'];
                                $saldo = $dato['Movimiento']['saldo'];
                                $total = $dato['Movimiento']['total'];
                            }else{
                               $saldo = 0;
                               $ingreso = 0;
                               $total = 0;
                            }
                        ?>
                        <td><?php echo $ingreso;?></td>
                        <?php endforeach;?>
                    </tr>            
            </tbody>
        </table>
        </br>
        </br>
        </br>
        </br>
        
        <table class="simple-table responsive-table" id="sorting-example2">


            <thead>
                <tr> 
                    <td>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    </td>                  
                    <td>______________________________</br></br>
                    <FONT SIZE="+1" style="color: #A64949">&nbsp;&nbsp;&nbsp;ENTREGUE CONFORME</FONT></br>
                    <?php //echo $entregas['Movimiento']['persona_id']?>
                    </td>
                    
                    <td>______________________________</br></br>
                    <FONT SIZE="+1" style="color: #A64949">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RECIBI CONFORME</FONT></br></td>

                </tr>
                
            </thead> 
        </table>
</div>

    
</section>	

<!-- Sidebar/drop-down menu -->
<?php echo $this->element('sidebar/almacenero'); ?>
<!-- End sidebar/drop-down menu --> 

